Task based help |
Here is few overviews of something like how-to:
A list of available languages can be obtained from TbsPolyglotManager class through LangCount and Langs properties.
Example:
// fill combo box with available languages // combo box name is cbLanguages // PolyglotManager is TbsPolyglotManager component added to the form var i: Integer; begin // clear combo box items cbLanguages.Items.Clear; // enum all languages available in core polyglot and add to combo box for i := 0 to PolyglotManager.LangCount - 1 do begin cbLanguages.Items.Add(PolyglotManager.Langs[i]); // set currently selected language as selected item in combo box if PolyglotManager.Langs[i] = PolyglotManager.CurrentLang then cbLanguages.ItemIndex := i; end; end;
There are few possible reasons to not display correctly symbols:
Switching from one language to other are very simple just change CurrentLang property of TbsPolyglotManager or TbsCorePolyglot. You can obtain an instance of TbsCorePolyglot through class function TbsCorePolyglot.GetCorePolyglot
Not all vendors mark properties as Localizable for different reasons (they don't think about localization, component originally developed for Delphi 3 or Delphi 4 and so on). But it is not a problem to translate such property. There are few alternative ways to do it:
Manually add these properties to generated LNG file , see LNG file format for more info (It is easy if it occurs once or twice but it is a big piece of work if this property occurs many times across an application);
Add it to "filter by property name" in Generate LNG file wizard (good way but it is possible that ten other components have property with same name and you don't need to localize them);
The most complex, but the most reliable way is to add properties by your own. Create new design-time package that uses required third party component. And in this package create procedure Register that will register required property in Localizable group.
procedure Register; begin RegisterPropertiesInCategory('Localizable', TBsTaskBar, ['LeftCaption', 'ActiveCaption']); end;
It means that you need update resource string translations, don't worry you will not lose your translations. If you change program code then resourcestring ids can be changed and you need to run "LNG Generate Wizard" to update resource strings. Read more about resourcestrings